package main

import (
	"fmt"
	"strings"
	"time"
)

func main() {
	array := strings.Split("123456789", "")
	ch := make(chan struct{})
	for _, s := range array {
		temp := s
		go func() {
			time.Sleep(1 * time.Second)
			fmt.Println(temp)
			ch <- struct{}{}
		}()
	}
	for range array {
		<-ch
	}
}
